<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>UUID在线生成器</title>
    <meta
      name="description"
      content="UUID在线生成器，支持生成多版本UUID，批量生成UUID，支持多种格式输出"
    />
    <meta
      name="keywords"
      content="UUID,GUID,UUID生成,UUID在线生成,批量生成UUID"
    />
    <link rel="icon" href="vite.svg" />
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      body {
        font-family:
          -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
        line-height: 1.6;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        min-height: 100vh;
        padding: 20px;
      }

      .container {
        max-width: 1200px;
        margin: 0 auto;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 12px;
        padding: 30px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
      }

      h1 {
        text-align: center;
        color: #333;
        margin-bottom: 30px;
        font-size: 2.5em;
        font-weight: 300;
      }

      .form-group {
        margin-bottom: 20px;
      }

      .form-row {
        display: flex;
        gap: 20px;
        margin-bottom: 20px;
        flex-wrap: wrap;
      }

      .form-col {
        flex: 1;
        min-width: 200px;
      }

      label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
        color: #333;
      }

      input[type="text"],
      input[type="number"],
      select {
        width: 100%;
        padding: 10px 12px;
        border: 2px solid #ddd;
        border-radius: 6px;
        font-size: 14px;
        transition: border-color 0.3s ease;
      }

      input[type="text"]:focus,
      input[type="number"]:focus,
      select:focus {
        outline: none;
        border-color: #667eea;
      }

      button {
        padding: 10px 20px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.3s ease;
        margin-right: 10px;
        margin-bottom: 10px;
      }

      .btn-primary {
        background: #667eea;
        color: white;
      }

      .btn-primary:hover {
        background: #5a6fd8;
      }

      .btn-secondary {
        background: #f0f0f0;
        color: #333;
      }

      .btn-secondary:hover {
        background: #e0e0e0;
      }

      .btn-success {
        background: #28a745;
        color: white;
      }

      .btn-success:hover {
        background: #218838;
      }

      .radio-group {
        display: flex;
        gap: 15px;
        flex-wrap: wrap;
      }

      .radio-item {
        display: flex;
        align-items: center;
        gap: 5px;
      }

      textarea {
        width: 100%;
        padding: 12px;
        border: 2px solid #ddd;
        border-radius: 6px;
        font-family: "Courier New", monospace;
        font-size: 14px;
        resize: vertical;
        min-height: 200px;
        max-height: 400px;
        background: #f8f9fa;
      }

      .namespace-fields {
        background: #f8f9fa;
        padding: 20px;
        border-radius: 8px;
        margin-bottom: 20px;
      }

      .namespace-fields.hidden {
        display: none;
      }

      .button-group {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
      }

      @media (max-width: 768px) {
        .form-row {
          flex-direction: column;
        }

        .radio-group {
          flex-direction: column;
        }

        .button-group {
          flex-direction: column;
        }

        .container {
          padding: 20px;
        }
      }
    </style>
  </head>
  <body>
    <div class="container">
      <h1>UUID在线生成器</h1>

      <div class="form-group">
        <label for="singleUuid">生成的UUID</label>
        <div class="form-row">
          <input
            type="text"
            id="singleUuid"
            readonly
            placeholder="点击刷新按钮生成UUID"
          />
          <button id="singleRefresh" class="btn-primary">刷新</button>
          <button id="singleUuidCopy" class="btn-secondary">复制</button>
        </div>
      </div>

      <div class="form-row">
        <div class="form-col">
          <label for="uuidVersion">UUID版本</label>
          <select id="uuidVersion">
            <option value="v1">Version 1 (时间戳)</option>
            <option value="v3">Version 3 (MD5)</option>
            <option value="v4" selected>Version 4 (随机)</option>
            <option value="v5">Version 5 (SHA-1)</option>
            <option value="v6">Version 6 (时间戳)</option>
            <option value="v7">Version 7 (时间戳)</option>
          </select>
        </div>

        <div class="form-col">
          <label for="batchCount">生成数量</label>
          <input
            type="number"
            id="batchCount"
            min="1"
            max="1000000"
            value="100"
          />
        </div>

        <div class="form-col">
          <label for="resultFormat">结果格式</label>
          <select id="resultFormat">
            <option value="string" selected>String</option>
            <option value="hex">Hex</option>
            <option value="binary">Binary</option>
            <option value="base64">Base64</option>
          </select>
        </div>
      </div>

      <div class="form-row">
        <div class="form-col">
          <label>大小写</label>
          <div class="radio-group">
            <div class="radio-item">
              <input type="radio" id="caseUpper" name="case" value="upper" />
              <label for="caseUpper">大写</label>
            </div>
            <div class="radio-item">
              <input
                type="radio"
                id="caseLower"
                name="case"
                value="lower"
                checked
              />
              <label for="caseLower">小写</label>
            </div>
          </div>
        </div>

        <div class="form-col">
          <label>中划线</label>
          <div class="radio-group">
            <div class="radio-item">
              <input
                type="radio"
                id="lineKeep"
                name="line"
                value="keep"
                checked
              />
              <label for="lineKeep">保留</label>
            </div>
            <div class="radio-item">
              <input type="radio" id="lineRemove" name="line" value="remove" />
              <label for="lineRemove">去除</label>
            </div>
          </div>
        </div>
      </div>

      <div class="namespace-fields" id="namespaceFields">
        <h3>命名空间字段 (Version 3 & 5)</h3>
        <div class="form-row">
          <div class="form-col">
            <label for="uuidNamespace">命名空间UUID</label>
            <input
              type="text"
              id="uuidNamespace"
              placeholder="输入UUID命名空间或留空使用默认"
            />
          </div>
          <div class="form-col">
            <label for="uuidName">名称</label>
            <input type="text" id="uuidName" placeholder="输入名称" />
          </div>
        </div>
      </div>

      <div class="button-group">
        <button id="startBatch" class="btn-primary">生成UUID</button>
        <button id="startCopy" class="btn-secondary">复制结果</button>
        <button id="startDownload" class="btn-secondary">下载文件</button>
        <button id="startClear" class="btn-secondary">清空</button>
      </div>

      <div class="form-group">
        <label for="generateContent">生成结果</label>
        <textarea
          id="generateContent"
          readonly
          placeholder="生成的UUID将显示在这里"
        ></textarea>
      </div>
    </div>

    <!-- UUID Generator JavaScript -->
    <script type="module" src="/src/uuid-generator.js"></script>
  </body>
</html>
